/**
 * Copyright(c) 2013 Jade Techonologies Co., Ltd.
 *
 * History:
 *   13-4-23 上午10:15 Created by dwzhang
 */
package com.jade.framework.base.context;

import java.io.File;
import java.net.InetAddress;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Random;

import org.apache.commons.codec.digest.DigestUtils;

/**
 * 上下文工具类。
 *
 * @author dwzhang
 * @version 1.0 13-4-23 上午10:15
 */
public class ApplicationContextUtils
{
    private static JadeApplicationContext applicationContext;
    public static JadeApplicationContext getApplicationContext()
    {
        return applicationContext;
    }

    public static void setApplicationContext(JadeApplicationContext context)
    {
        applicationContext = context;
    }

    public static <T> T getBean(String name)
    {
        return (T)applicationContext.getBean(name);
    }

    public static <T> T getBean(String name, Class<T> tClass)
    {
        return (T)applicationContext.getBean(name, tClass);
    }

    public static <T> T getBean(Class<T> tClass)
    {
        return (T)applicationContext.getBean(tClass);
    }

    public static boolean containsBean(String name)
    {
        return applicationContext.containsBean(name);
    }

    public static String getMessage(String code, Locale loc, Object... args)
    {
        return applicationContext.getMessage(code, loc, args);
    }


}
